// app.js
import net from './js/net'
import request from './js/http'
import login from './js/login'
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })

    //获取网站名
      request.request("index.php?r=api/index/info").then((res)=>{
        if(res.data.result){
          wx.setStorageSync('web_name', res.data.data.web_name);
        }
      });

  },
  globalData: {
    userInfo: null
  },
  get_name(){
    let web_name = wx.getStorageSync('web_name');
    wx.setNavigationBarTitle({
      title: web_name,
    })
  },
  http:request,
  url:net.http_url,
  base_url:net.base_url,
  up_pic:net.http_url+"index.php?r=user/up/up",
  login:login,
})
